package com.tanhua.model.vo;

import com.tanhua.model.domain.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @author Xiao
 * @version 1.0
 * @description 联系人VO
 * @date 2021/10/30
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ContactVO implements Serializable {
    private Long id;
    private String userId;
    private String avatar;
    private String nickname;
    private String gender;
    private Integer age;
    private String city;

    public static ContactVO init(UserInfo userInfo) {
        ContactVO contactVo = new ContactVO();
        if(userInfo != null) {
            BeanUtils.copyProperties(userInfo, contactVo);
            contactVo.setUserId("hx"+userInfo.getId().toString());
        }
        return contactVo;
    }
}
